#ifndef _GAITSET_H
#define _GAITSET_H


#include <fstream>
#include <iostream>
#include <sstream>
#include <time.h>
#include <algorithm>
#include <assert.h>
#include <opencv2/opencv.hpp>
#include <cuda_runtime_api.h>

#include "NvInfer.h"
#include "NvInferPlugin.h"
#include "logging.h"
#include "cuda_utils.h"


using namespace std;
using namespace nvinfer1;

static Logger gLogger;


class GaitSetContext {
public:
	GaitSetContext(string engineFile) {
        if (buildEngine(engineFile)) {
            context = engine->createExecutionContext();
            for (int i = 0; i < engine->getNbBindings(); i++) {
                auto dims = context ? context->getBindingDimensions(i) : engine->getBindingDimensions(i);
                cout << "Nb:" << i << "\tDims: [";
                for (int j = 0; j < dims.nbDims; j++) {
                    cout << dims.d[j] << " ";
                }
                cout << "]" << endl;
            }
        }
        INPUT_SIZE = 1 * 30 * 1 * 64 * 44;
        OUTPUT_SIZE = 1 * 62 * 256;
        input = new float[INPUT_SIZE];
        feature_vector = new float[OUTPUT_SIZE];
	}

    int INPUT_SIZE;
    int OUTPUT_SIZE;
    float* feature_vector;
    float* input;

    bool doInference(vector<cv::Mat> seq);
private:
	ICudaEngine* engine;
	IExecutionContext* context;

	bool buildEngine(string engineFile);
};

#endif